home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group96a.txt
/
000098_icon-group-sender _Fri Apr 19 13:53:43 1996.msg
< prev
next >
Wrap
Internet Message Format
|
1996-09-05
|
1KB
Received: by cheltenham.cs.arizona.edu; Fri, 19 Apr 1996 19:14:12 MST
Date: Fri, 19 Apr 1996 13:53:43 -0700
Message-Id: <199604192053.NAA06439@dfw-ix2.ix.netcom.com>
X-Sender: bobalex@ix.netcom.com
X-Mailer: Windows Eudora Pro Version 2.1.2
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
To: icon-group@cs.arizona.edu
From: Bob Alexander <bobalex@ix.netcom.com>
Subject: Re: Making a list out of a generated sequence
Errors-To: icon-group-errors@cs.arizona.edu
Status: O
Since I sent out the following:
>> every tempList := put([], !"string")
>
>That is a VERY COOL Icon idiom -- wish I'd thought of it!
>
>It consumes a bit of time though, so for cases where that is bad the
old-fashioned way is better. I did some trivial timings of
>
> every x := put([],1 to 500000) (1)
>
> vs.
>
> x := []; every put(x,1 to 500000) (2)
>
>and came out with about 7.5 vs. 5.7 sec -- apparently the cost of doing
1/2M >assignments.
...I received this refinement independently from two separate Icon wizards
who reside in different states:
every put(x := [],1 to 500000) (3)
It runs just as fast as (2), has the terseness if (1), and is maybe even a
bit easier to comprehend than (1). Thanks Steve and Clint -- this one's
going into my permanent idiom collection.
-- Bob